package jp.joogoo.web.meta;

//@javax.annotation.Generated(value = { "slim3-gen", "@VERSION@" }, date = "2010-11-05 22:45:10")
/** */
public final class M_serviceMeta extends org.slim3.datastore.ModelMeta<jp.joogoo.web.model.M_service> {

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.M_service> consumerToken = new org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.M_service>(this, "consumerToken", "consumerToken");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.joogoo.web.model.M_service, com.google.appengine.api.datastore.Key> key = new org.slim3.datastore.CoreAttributeMeta<jp.joogoo.web.model.M_service, com.google.appengine.api.datastore.Key>(this, "__key__", "key", com.google.appengine.api.datastore.Key.class);

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.M_service> serviceName = new org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.M_service>(this, "serviceName", "serviceName");

    /** */
    public final org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.M_service> serviceProvider = new org.slim3.datastore.StringAttributeMeta<jp.joogoo.web.model.M_service>(this, "serviceProvider", "serviceProvider");

    /** */
    public final org.slim3.datastore.CoreAttributeMeta<jp.joogoo.web.model.M_service, java.lang.Long> version = new org.slim3.datastore.CoreAttributeMeta<jp.joogoo.web.model.M_service, java.lang.Long>(this, "version", "version", java.lang.Long.class);

    private static final M_serviceMeta slim3_singleton = new M_serviceMeta();

    /**
     * @return the singleton
     */
    public static M_serviceMeta get() {
       return slim3_singleton;
    }

    /** */
    public M_serviceMeta() {
        super("M_service", jp.joogoo.web.model.M_service.class);
    }

    @Override
    public jp.joogoo.web.model.M_service entityToModel(com.google.appengine.api.datastore.Entity entity) {
        jp.joogoo.web.model.M_service model = new jp.joogoo.web.model.M_service();
        model.setConsumerToken((java.lang.String) entity.getProperty("consumerToken"));
        model.setKey(entity.getKey());
        model.setServiceName((java.lang.String) entity.getProperty("serviceName"));
        model.setServiceProvider((java.lang.String) entity.getProperty("serviceProvider"));
        model.setVersion((java.lang.Long) entity.getProperty("version"));
        return model;
    }

    @Override
    public com.google.appengine.api.datastore.Entity modelToEntity(java.lang.Object model) {
        jp.joogoo.web.model.M_service m = (jp.joogoo.web.model.M_service) model;
        com.google.appengine.api.datastore.Entity entity = null;
        if (m.getKey() != null) {
            entity = new com.google.appengine.api.datastore.Entity(m.getKey());
        } else {
            entity = new com.google.appengine.api.datastore.Entity(kind);
        }
        entity.setProperty("consumerToken", m.getConsumerToken());
        entity.setProperty("serviceName", m.getServiceName());
        entity.setProperty("serviceProvider", m.getServiceProvider());
        entity.setProperty("version", m.getVersion());
        entity.setProperty("slim3.schemaVersion", 1);
        return entity;
    }

    @Override
    protected com.google.appengine.api.datastore.Key getKey(Object model) {
        jp.joogoo.web.model.M_service m = (jp.joogoo.web.model.M_service) model;
        return m.getKey();
    }

    @Override
    protected void setKey(Object model, com.google.appengine.api.datastore.Key key) {
        validateKey(key);
        jp.joogoo.web.model.M_service m = (jp.joogoo.web.model.M_service) model;
        m.setKey(key);
    }

    @Override
    protected long getVersion(Object model) {
        jp.joogoo.web.model.M_service m = (jp.joogoo.web.model.M_service) model;
        return m.getVersion() != null ? m.getVersion().longValue() : 0L;
    }

    @Override
    protected void incrementVersion(Object model) {
        jp.joogoo.web.model.M_service m = (jp.joogoo.web.model.M_service) model;
        long version = m.getVersion() != null ? m.getVersion().longValue() : 0L;
        m.setVersion(Long.valueOf(version + 1L));
    }

    @Override
    protected void prePut(Object model) {
        assignKeyIfNecessary(model);
        incrementVersion(model);
    }

    @Override
    public String getSchemaVersionName() {
        return "slim3.schemaVersion";
    }

    @Override
    public String getClassHierarchyListName() {
        return "slim3.classHierarchyList";
    }

}